import logging; logging.basicConfig(filename='logger.log',level=logging.INFO)
#log日志模块介绍  http://www.jianshu.com/p/feb86c06c4f4       
import asyncio, os, json, time
from datetime import datetime

from aiohttp import web

#响应代码
def index(request):
    return web.Response(body=b'<h1>Awesome</h1>')

#初始化
async def init(loop):
    app = web.Application(loop=loop)
    app.router.add_route('GET', '/', index)
    srv = await loop.create_server(app.make_handler(), '127.0.0.1', 9000)
    logging.info('server started at http://127.0.0.1:9000...')
    return srv

loop = asyncio.get_event_loop()
loop.run_until_complete(init(loop))
loop.run_forever()